﻿Imports System.Data.OleDb
Imports DTO

Public Class LoaiDocGiaDAO
    Public Function LayDSLoaiDocGia() As List(Of LoaiDocGiaDTO)
        Dim str As String = "select MaLoaiDocGia , TenLoaiDocGia from LOAIDOCGIA"
        DataProvider.OpenConnecttion()
        Dim reader As OleDbDataReader = DataProvider.ExecSelect(str)
        Dim dsldg As New List(Of LoaiDocGiaDTO)

        While reader.Read()
            Dim ldg As New LoaiDocGiaDTO()
            ldg.MaLoaiDocGia = reader.GetInt32(0)
            ldg.TenloaiDocGia = reader.GetString(1)
            dsldg.Add(ldg)
        End While

        DataProvider.CloseConnect()
        'reader.Close()
        Return dsldg
    End Function

    Public Function ThemLoaiDocGia(ByVal str As String) As Integer
        DataProvider.OpenConnecttion()
        Dim kw As Integer = DataProvider.ExecInsert(str)
        DataProvider.CloseConnect()
        Return kw
    End Function
    Public Function CapNhatLoaiDocGia(ByVal sql As String) As Integer
        DataProvider.OpenConnecttion()
        Dim kq As Integer = DataProvider.ExecInsert(sql)
        DataProvider.CloseConnect()
        Return kq
    End Function

End Class
